package com.isunland.managesystem.ui;

import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.Fragment;
import com.isunland.managesystem.R;
import com.isunland.managesystem.base.BasePagerActivity;

public class WorkProcessListActivity extends BasePagerActivity {

  WorkProcessListFragment mProcessListFragment;
  WorkProcessFinishListFragment mFinishListFragment;
  private int[] title = { R.string.workPlan, R.string.hasFinishplan };

  @Override protected Fragment createFragmentOne() {
    mProcessListFragment = new WorkProcessListFragment();
    return mProcessListFragment;
  }

  @Override protected Fragment createFragmentTwo() {
    mFinishListFragment = new WorkProcessFinishListFragment();
    return mFinishListFragment;
  }

  @Override protected int[] createTitle() {

    return title;
  }

  @Override protected void setFixedTitle(boolean isFixedTitle, String fixedTitle) {
    // Auto-generated method stub
    super.setFixedTitle(true, getString(R.string.workPlanAndsummary));
  }

  @Override public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
      return;
    }
    if (WorkProcessListFragment.REQUEST_FINISH == requestCode
        || WorkProcessListFragment.REQUEST_ADD == requestCode) {
      if (mProcessListFragment != null) mProcessListFragment.volleyPost();
      if (mFinishListFragment != null) mFinishListFragment.volleyPost();
    }

    super.onActivityResult(requestCode, resultCode, data);
  }
}
